package com.example.mapper;

import com.example.pojo.Address;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;

@Mapper
public interface AddressMapper {

    // 查询所有顶级地址(parent_id=0)
    @Select("select id as value, content from address where parent_id = 0")
    List<Address> selectTopLevel();

    // 根据父级ID查询子地址
    @Select("select id as value, content from address where parent_id = #{parentId}")
    List<Address> selectByParentId(Integer parentId);
}